package edu.uw.tcss360.group6.gui.MainCards;


import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.*;

import edu.uw.tcss360.group6.model.Contest;
import edu.uw.tcss360.group6.model.User;


/**
 * Created with IntelliJ IDEA.
 * edu.uw.tcss360.group6.model.User: Lemtzas
 * Author: Mais Abdulwahab
 * Date: 2/24/13
 */
@SuppressWarnings("serial")
public class OrganizerSplashPanel extends MainCard {
    public OrganizerSplashPanel() {
        super();
        GridLayout bl = new GridLayout(4,1);
        this.setLayout(bl);
        this.add(new JTextArea("Organizer Splash Page"));
       
        User[] users = Contest.instance().getUsers();
        JTextArea attendees_field = new JTextArea();
        attendees_field.setEditable(false);
        attendees_field.setBackground(Color.yellow);
        JScrollPane attendees_scrollPane = new JScrollPane(attendees_field);
        attendees_field.append("(Attendees)");
        JTextArea contestants_field = new JTextArea();
        contestants_field.setEditable(false);
        JScrollPane contestants_scrollPane = new JScrollPane(contestants_field);
        contestants_field.append("(Contestants)");
        contestants_field.setBackground(Color.yellow);
        JTextArea judges_field = new JTextArea();
        judges_field.setEditable(false);
        JScrollPane judges_scrollPane = new JScrollPane(judges_field);
        judges_field.append("(Judges)");
        judges_field.setBackground(Color.yellow);
        for(int i = 0; i < users.length; i++)
        {
        	if((users[i].getClass().getSimpleName().toLowerCase()).equals("user"))
        	{
        		attendees_field.append("\n");
        		attendees_field.append(users[i].getName());
        	}
        	
        	if((users[i].getClass().getSimpleName().toLowerCase()).equals("contestant"))
        	{
        		contestants_field.append("\n");
        		contestants_field.append(users[i].getName());
        	}
        	if((users[i].getClass().getSimpleName().toLowerCase()).equals("judge"))
        	{
        		judges_field.append("\n");
        		judges_field.append(users[i].getName());
        	}
        }
        this.add(attendees_scrollPane);
        this.add(contestants_scrollPane);
        this.add(judges_scrollPane);
        
    }
}
